const mongoose = require('./db')

const tellSchema = mongoose.Schema({
    tell: String,
    password:String,
})


let VideoSchema = new mongoose.Schema({
    title: String,    // 标题
    VideoSrc: String,    // 视频地址
    coverSrc: String,    // 封面地址
    like: Number,    // 视频点赞
    comment: {
        type: [mongoose.Types.ObjectId],
        ref: 'videoComment'
    },    // 视频评论
})

const UsersSchema = new mongoose.Schema({
    username:String,
    usertext:String,
    usercar:String,
    userqian:String,
    userprofile:String,
    usertitle:String,
    userid:{
        type:[mongoose.Schema.Types.ObjectId],
        ref:'usersimage'
    }  
})


const Usersimage = new mongoose.Schema({
    userimg:String,
})

const UsersModel = mongoose.model('user', UsersSchema, 'user')
const UsersimageModel = mongoose.model('usersimage', Usersimage, 'usersimage')
const tellModel = mongoose.model('tell', tellSchema, 'tell')
let videoModel = mongoose.model('video', VideoSchema, 'video')

// videoModel.create({
//     VideoSrc: 'http://localhost:3000/public/video/8.mp4'
// })

// videoModel.create({
//         title:'真帅呢'
//     })

// tellModel.create({
//     tell:'18839273378',
//     password:'123456'

// })
module.exports = { videoModel, UsersModel, UsersimageModel, tellModel }
